import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CartService } from 'src/app/cart.service';
type Product = {
  name: String;
  price: Number;
  number: Number;
};
@Component({
  selector: 'app-project-tasks-list-ts',
  templateUrl: './project-tasks-list-ts.component.html',
  styleUrls: ['./project-tasks-list-ts.component.scss'],
})
export class ProjectTasksListTsComponent implements OnInit {
  public id: string;
  constructor(
    private cartService: CartService,
    private ActivatedRoute: ActivatedRoute
  ) {
    this.id = '';
  }
  addToCart(product: Product) {
    this.cartService.addToCart(product);
    window.alert('Your product has been added to the cart!');
  }
  ngOnInit(): void {
    console.log(this.ActivatedRoute);
    let { id } = this.ActivatedRoute.snapshot.params;
    this.id = id;
  }
}
